<extend name="Common:common"/>
<block name="main">

    <div class="main-content">
        <div class="breadcrumbs" id="breadcrumbs">
            <script type="text/javascript">
                try {
                    ace.settings.check('breadcrumbs', 'fixed')
                } catch (e) {
                }
            </script>

            <ul class="breadcrumb">
                <li>
                    <i class="icon-home home-icon"></i>
                    <a href="#"> 云系统管理平台</a>
                </li>

                <li>
                    <a href="#">系统基本信息</a>
                </li>
                <li class="active">系统设置</li>
            </ul>
            <!-- .breadcrumb -->

            <div class="nav-search" id="nav-search">
                <form class="form-search">
                <span class="input-icon">
                    <input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input"
                           autocomplete="off"/>
                    <i class="icon-search nav-search-icon"></i>
                </span>
                </form>
            </div>
            <!-- #nav-search -->
        </div>

        <div class="page-content">

            <div class="row">
                <form action="{:U('Home/Rbac/createadminrole')}" method="post"  class="form-horizontal">
                    <div class="widget-content nopadding">
                            <div class="control-group">
                                <label class="control-label">角色名称:</label>
                                <div class="controls">
                                    <input type="text" class="span11" placeholder="角色名称" name="name" style="width: 140px;" />
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label">角色描述:</label>
                                <div class="controls">
                                    <textarea class="span11" name="remark" id="remark" style="width: 200px;"  ></textarea>
                                </div>
                            </div>
                            <div class="form-actions">
                                <input type="hidden" name="pid" value="0">
                                <button type="submit" class="btn btn-success">确认</button>
                            </div>
                        </form>
                    </div>
                </form>
            </div>
        </div><!-- /.page-content -->
    </div><!-- /.main-content -->

    <script src="__PUBLIC__/Common/js/jquery.validate-1.13.1.js"></script>
    <script type="text/javascript">
        var $URL = "__APP__/Home/Rbac/";
        jQuery(function($){
            $("#createfrom").validate({
                rules:{
                    name: {
                        required: true,
                        minlength: 4,
                        maxlength: 32
                    },
                    remark: {
                        required: true,
                        minlength: 2,
                        maxlength: 256
                    }

                },
                messages: {
                    name: {
                        required: '用户名不能为空',
                        minlength: '角色名称不能小于6个字符',
                        maxlength: '角色名称不能超过24个字符'
                    },
                    remark: {
                        required: '角色描述不能为空',
                        minlength: '角色描述不能小于2个字符',
                        maxlength: '角色描述不能超过256个字符'
                    }
                }
            });
            $.validator.addMethod("check_name", function(value, element, params){
                var str = /^[A-Za-z]+$/;
                return this.optional(element) || (str.test(value));
            }, "必须为英文字母组成");
            $.validator.addMethod("check_num", function(value, element, params){
                var str = /^\d+(\.\d+)?(\.\d+)?(\.\d+)?$/;
                return this.optional(element) || (str.test(value));
            }, "版本号格式不正确");
        });
    </script>
</block>

